{extend name="layouts@base" /}
{block name="head"}
<link rel="stylesheet" href="__STATIC__/mobile/default/css/userData.css"/>
<style>

label .payType{ width:4.3rem;}
</style>
{/block}
{block name="pageType"}takeOut{/block}
{block name="main" }
<form id="bakn_from">
<div class="page-bd userData">
  <!-- 页面内容-->
        <div class="cells">
          <div class="cell bankType">
            <div class="cell_hd"><span class="fs28 color_3 fw_b">银行类型</span></div>
            <div class="cell_bd">                
                <input type="text" class="fs28  color_3 bankBox" name="bank_name" placeholder="请选择银行类型" readonly value="中国银行">
            </div>
            <div class="cell_ft">
            </div>
          </div>
          <div class="cell">
              <div class="cell_hd"><span class="fs28 color_3 fw_b">持卡人</span></div>
            <div class="cell_bd">
                <input type="text" class="fs28  color_3" name="bank_cardholder" placeholder="请输入持卡人姓名">
            </div>

          </div>
          <div class="cell">
              <div class="cell_hd"><span class="fs28 color_3 fw_b">卡号</span></div>
            <div class="cell_bd">
                <input type="text" class="fs28  color_3" name="bank_card_number" placeholder="请输入卡号">
            </div>
          </div>
          <div class="cell">
              <div class="cell_hd"><span class="fs28 color_3 fw_b">持卡人电话</span></div>
            <div class="cell_bd">
                <input type="text" class="fs28  color_3" name="bank_cardholder_phone" placeholder="请输入持卡人电话">
            </div>
          </div>
          <div class="cell">
              <div class="cell_hd"><span class="fs28 color_3 fw_b">网点所在地</span></div>
            <div class="cell_bd">
                <input type="text" class="fs28  color_3" name="bank_location_outlet" placeholder="请输入网点所在地">
            </div>
          </div>
          <div class="cell">
              <div class="cell_hd"><span class="fs28 color_3 fw_b">支行名称</span></div>
            <div class="cell_bd">
                <input type="text" class="fs28 color_3" name="bank_branch_name" placeholder="请输入支行名称">
            </div>
          </div>
        </div> 
        <div class="page-ft">
            <span class="fs32 color_w fw_b BGcolor_r postBtn">确认添加</span>
          </div>
      </div>
      <!-- 支付方式 -->
      <div class="model">
          <div class="modelBg"></div>
          <div class="modelContent">
            <div class="closeBox"><img src="__STATIC__/mobile/default/images/close_icon.png" alt=""></div>
            <div class="title fs36 color_3 fw_b">请选择银行</div>
            <div class="cantre">
              <div class="block">
                  <label for="s11">
                  <div class="payType"><img src="__STATIC__/mobile/default/images/ZGBank.png" alt=""><span class="fs30 color_3">中国银行</span></div>
                      <div class="iconBox">
                        <input type="radio" class="check" name="bank_code" value="ZG" id="s11" checked>
                        <i class="icon_checked"></i>
                      </div>
                  </label>
              </div>
              <div class="block">
                  <label for="s12">
                  <div class="payType"><img src="__STATIC__/mobile/default/images/JSBank.png" alt=""><span class="fs30 color_3">中国建设银行</span></div>
                      <div class="iconBox">
                        <input type="radio" class="check" name="bank_code" value="JS" id="s12">
                        <i class="icon_checked"></i>
                      </div>
                  </label>
              </div>
              <div class="block">
                  <label for="s13">
                  <div class="payType"><img src="__STATIC__/mobile/default/images/GSBank.png" alt=""><span class="fs30 color_3">中国工商银行</span></div>
                      <div class="iconBox">
                        <input type="radio" class="check" name="bank_code" value="GS" id="s13" >
                        <i class="icon_checked"></i>
                      </div>
                  </label>
              </div>
              <div class="block">
                  <label for="s14">
                <div class="payType"><img src="__STATIC__/mobile/default/images/NYBank.png" alt=""><span class="fs30 color_3">中国农业银行</span></div>
                    <div class="iconBox">
                      <input type="radio" class="check" name="bank_code" value="NY" id="s14" >
                      <i class="icon_checked"></i>
                    </div>
                </label>
            </div>
            <div class="block">
                <label for="s15">
              <div class="payType"><img src="__STATIC__/mobile/default/images/ZSBank.png" alt=""><span class="fs30 color_3">招商银行</span></div>
                  <div class="iconBox">
                    <input type="radio" class="check" name="bank_code" value="ZS" id="s15" >
                    <i class="icon_checked"></i>
                  </div>
              </label>
          </div>
          <div class="block">
              <label for="s16">
            <div class="payType"><img src="__STATIC__/mobile/default/images/JTBank.png" alt=""><span class="fs30 color_3">交通银行</span></div>
                <div class="iconBox">
                  <input type="radio" class="check" name="bank_code" value="JT" id="s16" >
                  <i class="icon_checked"></i>
                </div>
            </label>
        </div>
            </div>
          </div>

</div>
</form>
{/block}

{block name="footer"}
<script>
$(function(){
  $('.bankType').on('click',function(){
	  $('.model').show();
	})
	$('.block label').on('click',function(){
	  if($(this).find('input').is(':checked')){
		   var nameVal= $(this).find('span').text();
		   $('.bankBox').val(nameVal)
		   $('.model').hide();
	  }
	})
	$('.closeBox').on('click',function(){
	  $('.model').hide();
	})
	$('.modelBg').on('click',function(){
	  $('.model').hide();
	})
	
	$('.postBtn').click(function (){
		var arr = $('#bakn_from').toJson();
		if (arr.bank_name == ''){
			_alert('请选择银行.');
			return false;	
		}
		if (arr.bank_cardholder == ''){
			_alert('请输入持卡人姓名.');
			return false;	
		}
		if (arr.bank_card_number == ''){
			_alert('请输入卡号.');
			return false;	
		}
		if (arr.bank_cardholder_phone == ''){
			_alert('请输入持卡人电话.');
			return false;	
		}
		if (arr.bank_location_outlet == ''){
			_alert('请输入网点所在地.');
			return false;	
		}
		if (arr.bank_branch_name == ''){
			_alert('请输入支行名称.');
			return false;	
		}
		jq_ajax('{:url("member/api.withdraw/addBank")}',arr,function(res){
			if (res.code == 0){
				_alert(res.msg);
				return false;
			}
			window.location.href = '{:url("member/withdraw/index")}';	
		});	
		
	})
})
</script>
{/block}